package org.csmzxy.class2333;

class person{
    String name;
    int age;
    public void eat(){
        System.out.println("吃饭");
    }
    public void sleep(){
        System.out.println("睡觉");
    }
}
class Student extends person{
    public void study(){
        System.out.println("学习");
    }
}
class Teacher extends person{
    int salary;
    public void teach(){
        System.out.println("教书");
    }
}
public class Example01 {
    public static void main(String[] args){
        Student stu = new Student();
        stu.name = "张三";
        stu.age = 16;
        System.out.println("我叫"+ stu.name + ",我今年"+ stu.age + "岁了");
        System.out.println("我可执行如下方法：");
        stu.eat();
        stu.sleep();
        stu.study();
        Teacher tea = new Teacher();
        tea.name = "李四";
        tea.age=30;
        tea.salary=5000;
        System.out.println("我叫"+tea.name +",我今年"+tea.age+"我的薪资是"+tea.salary);
        System.out.println("我可执行如下方法：");
        tea.eat();
        tea.sleep();
        tea.teach();
    }
}
